
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  vector<int> v1{1, 2, 3, 4};
  // 仅仅是把扩容的部分初始化为8  先前的值不变
  v1.resize(8, 8);
  for (int i = 0; i < v1.size(); ++i)
    cout << v1[i] << "  ";
  cout << endl;

  vector<int> v2;
  cout << v2.data() << endl;

  vector<double> rv(1000);
  cout << rv[999] << endl;
  double *rp = new double[1000];
  cout << rp[999] << endl;

  vector<int> vp(0);
  cout << "vp.size = " << vp.size() << endl;

  const int n = 10000000;
  vector<int> vec;
  int vec_capacity = vec.capacity();
  for (int i = 0; i < n; ++i) {
    vec.push_back(i);
    if (vec.capacity() != vec_capacity) {
      cout << vec.capacity() << endl;
      vec_capacity = vec.capacity();
    }
  }

  vector<int> vec_sz(3, 3);
  cout << sizeof(vec_sz) << endl;

  return 0;
}